"""


"""

import threading
from DAL.sqlHelper import get_keyboard_conn as conn,get_recharge_conn as getconn

def restart_conn():
    try:
        if conn:
            conn.ping()
        else:
            getconn()
    except:
        getconn()

def Timers(delay):
    # 要执行的代码体
    # 代码体按顺序执行后，重新启动一个定时器，调用函数自身
    restart_conn()
    timer = threading.Timer(delay, Timers, args=[delay])
    timer.start()

# 单独创建一个定时器，用于首次执行
delay = 7000
timer = threading.Timer(delay, Timers, args=[delay])
timer.start()
